﻿using Services.Initial.PublicProject.PublicClass.ExtensionException;

namespace Services.Identity.Domain.Entities;

public class UnsentUser
{
    public long UnsentId { get; set; }
    public long UserId { get; set; }
    public bool IsSent { get; set; } = false;
    public long MessageId { get; set; }
    public UserMessage UserMessage { get; set; }
    public void Send()
    {
        this.IsSent = true;
    }
    private UnsentUser() { }
    public static UnsentUser Create(long userId)
    {
        if (userId < 0) { throw new ExceptionWithStatus(System.Net.HttpStatusCode.BadRequest, $"出现了未知的用户，id是{userId}"); }
        return new UnsentUser() { UserId = userId };
    }
}

